@extends('app')

@section('content')
<ul class="nav nav-tabs">
    <li class="active"><a href="{{ url('/admin/enterprise/company_type')}}">行业列表</a></li>
    <li><a href="{{ url('/admin/enterprise/company_type/create') }}">添加行业</a></li>
</ul>

<div class="panel panel-default description2 mt20">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>行业名称</th>
                    <th>排序</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach($category as $key=>$cg)
                <tr id="news_{{ $cg->id }}">
                    <td>
                        <font color="#428bca">@if(count($cg->childrenCates) > 0)
                        <i class="icon-chevron-down" id="father_{{$cg->id}}"></i>
                        @endif
                        {{ $cg->name }}</font>
                    </td>
                    <td>{{ $cg->sort }}</td>
                    <td>
                        <a href="{{ url('/admin/enterprise/company_type/create?catid='.$cg->id) }}"><i class="icon-plus-sign"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="{{ url('/admin/enterprise/company_type/'.$cg->id.'/edit') }}"><i class="icon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:void(0);" onclick="delete_one('/admin/enterprise/company_type/{{$cg->id}}','{{$cg->id}}','{{ csrf_token() }}')"><i class="icon-remove-sign"></i></a>
                    </td>
                </tr>
                    @foreach($cg->childrenCates as $subc)
                    <tr id="news_{{ $subc->id }}">
                        <td>
                            ｜－－ {{ $subc->name }} 
                            @if(count($subc->childrenCates) > 0)
                            <font color="#428bca"><i class="icon-chevron-down" style="margin-left:20px;" id="father_{{$cg->id}}"></i></font>
                            @endif
                        </td>
                        <td>{{ $subc->sort }}</td>
                        <td>
                            <a href="{{ url('/admin/enterprise/company_type/create?catid='.$subc->id) }}"><i class="icon-plus-sign"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="{{ url('/admin/enterprise/company_type/'.$cg->id.'/edit?secondcatid='.$subc->id) }}"><i class="icon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="javascript:void(0);" onclick="delete_one('/admin/enterprise/company_type/{{$subc->id}}','{{$subc->id}}','{{ csrf_token() }}')"><i class="icon-remove-sign"></i></a>
                        </td>
                    </tr>
                         @foreach($subc->childrenCates as $thirdc)
                            <tr  id="news_{{ $thirdc->id }}">
                                <td>
                                    ｜－－－－ {{ $thirdc->name }}
                                </td>
                                <td>{{ $thirdc->sort }}</td>
                                <td>
                                    <a href="#"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="{{ url('/admin/enterprise/company_type/'.$cg->id.'/edit?secondcatid='.$subc->id.'&thirdcatid='.$thirdc->id) }}"><i class="icon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="javascript:void(0);" onclick="delete_one('/admin/enterprise/company_type/{{$thirdc->id}}','{{$thirdc->id}}','{{ csrf_token() }}')"><i class="icon-remove-sign"></i></a>
                                    
                                </td>
                            </tr>
                         @endforeach
                    @endforeach
                @endforeach
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript">
    <!--
    function openMoreList(child,father){
        var fatherClass = $("#"+father).attr("class");
        if(fatherClass.indexOf("glyphicon-chevron-down")>1){
            $("#"+child).addClass("hide");
            $("#"+father).attr('class','glyphicon glyphicon-chevron-right')
        }else{
            $("#"+child).removeClass("hide");
            $("#"+father).attr('class','glyphicon glyphicon-chevron-down')
        }

    }
    //-->
</script>
@endsection
